// 判断对象是否为空或所有字段为空
export function isObjectEmptyOrAllFieldsEmpty(obj) {
  return Object.entries(obj).every(([key, value]) => {
    return value === '' || value === null || value === undefined || (typeof value === 'object' && Object.keys(value).length === 0);
  });
}

// 去除对象中为空的字段
export function removeEmptyFields(obj) {
  return Object.fromEntries(
    Object.entries(obj).filter(([key, value]) => {
      return value !== '' && value !== null && value !== undefined && !(typeof value === 'object' && Object.keys(value).length === 0);
    })
  );
}